﻿using System;
using System.Net;
using System.Net.Sockets;

namespace Framework.Networking
{
    /// <summary>
    /// Interface for a simple socket connection.
    /// </summary>
    public interface ISocket
    {
        /// <summary>
        /// Gets an ip address we're listening to.
        /// </summary>
        IPAddress Ip { get; }

        /// <summary>
        /// Gets port we're listening to.
        /// </summary>
        int Port { get; }

        /// <summary>
        /// Gets the socket we'll bind to.
        /// </summary>
        Socket BindedSocket { get; }

        /// <summary>
        /// Gets listen state.
        /// </summary>
        bool Listening { get; }

        /// <summary>
        /// Start accepting connections.
        /// </summary>
        void Start();

        /// <summary>
        /// Stop accepting connections.
        /// </summary>
        void Stop();

        /// <summary>
        /// Checks if interface and port if free for listening.
        /// </summary>
        /// <returns>true if interface and port is free</returns>
        //bool PortAvailable();

        /// <summary>
        /// Action on for traffic handling.
        /// </summary>
        /// <param name="ar"></param>
        ///void OnAccept(IAsyncResult ar);
    }
}
